#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{ 
  int a[10][10];
  int maxn = 0,minn = 100000;
  
  int hmax = 0,lmax = 0; 
  int hmin = 0,lmin = 0; 
  int is_founded = 0;
  
  for (int i = 0;i <  5;i++)
  {
    for (int j = 0;j <  5;j++)
    {
      cin >> a[i][j];
    }
  }
  
  cout << endl << endl;
  
  
  for (int m = 0;m<5 ;m++)
  {
  	for(int n=0;n<5;n++)
	{
		if (a[m][n]>maxn)
		{
			maxn = a[m][n];
			hmax = m;
			lmax = n;
		}			
	}
	cout << "max:" << hmax << " " << lmax << " " << maxn << endl;	 
	printf("hmax=%d,lmax=%d,a=%d\n",hmax,lmax,maxn);
	for (int x = 0;x<5;x++)
	{
		printf("a[%d][%d]=%d\n",x,lmax,a[x][lmax]); 
		if (minn> a[x][lmax])
		{
			minn = 	a[x][lmax];
			hmin = x;
			lmin = lmax;
		}
		
	}
	printf("hmin=%d,lmin=%d,a=%d\n",hmin,lmin,minn);
	printf("hmax=%d,lmax=%d,a=%d\n",hmax,lmax,maxn);

	printf("----------------------------------------\n");
	if (lmax== lmin && hmax==hmin)
	{
		printf("mmm:%d %d %d\n",hmax+1,lmax+1,a[hmax][lmax]);
		is_founded = 1;
	}	
	maxn=0;
	hmax = 0;
	lmax = 0;
	minn=10000;
	lmin = 0;
	hmin = 0;	
  }
 
  if (is_founded==0)
  	printf("not found\n");
  return 0;
} 
